package com.koicarp.university.graduate.auth.configure;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @auther liutao
 * @Date 2020-08-19 17:26:52
 */
@Configuration
public class WebMVCConfig implements WebMvcConfigurer {
//    public void addResourceHandlers(ResourceHandlerRegistry resourceHandlerRegistry){
//        resourceHandlerRegistry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
//    }

    public void addCorsMappings(CorsRegistry registry) {
        String url="http://localhost:9528";
        registry.addMapping("/**")
                .allowedOrigins(url)//跨域地址
                .allowedMethods("*")
                .allowedHeaders("*");
    }

}